Skip to content

fix(#4178): nested versioned events now dispatch to correct projection apply overload#4179

Merged
jeremydmiller merged 2 commits intoJasperFx:masterfrom
rd-wm:master
Mar 23, 2026
Merged

fix(#4178): nested versioned events now dispatch to correct projection apply overload#4179
jeremydmiller merged 2 commits intoJasperFx:masterfrom
rd-wm:master

Conversation

@rd-wm
Copy link
Copy Markdown
Contributor

@rd-wm rd-wm commented Mar 19, 2026

Closes #4178

EventNamingStyle.ClassicTypeName (default option) derives the type alias from the simple class name only. Both V1.CustomerCreated and V2.CustomerCreated collapse to "customer_created", so only one CLR type can occupy the _byEventName alias cache in EventGraph.

From EventGraph.cs, line 72:
_byEventName.OnMissing = name => AllEvents().FirstOrDefault(x => x.EventTypeName == name);

EventDocumentStorage.Resolve() / ResolveAsync() only fall back to reading the dotnet_type column (index 2) when the alias lookup returns null. Because the alias always matches something (the cache winner), dotnet_type was never consulted.

--

Really, my project should have used opts.Events.EventNamingStyle = EventNamingStyle.SmarterTypeName; but switching to that now would require modifying the mt_events table, which I don't feel is ideal. I suppose there may be an argument that SmarterTypeName should be default? (https://martendb.io/events/storage#event-type-names).

@rd-wm rd-wm marked this pull request as draft March 19, 2026 20:44
@jeremydmiller
Copy link
Copy Markdown
Member

I think that's fine, but let CI run on it now

@jeremydmiller
Copy link
Copy Markdown
Member

Yeah, sorry, no. That causes some regression errors.

@rd-wm
Copy link
Copy Markdown
Contributor Author

rd-wm commented Mar 19, 2026

Yeah, sorry, no. That causes some regression errors.

Ah! Leave it with me, the tests passed locally but maybe they weren't all discovered

@rd-wm rd-wm marked this pull request as ready for review March 19, 2026 23:26
@rd-wm
Copy link
Copy Markdown
Contributor Author

rd-wm commented Mar 19, 2026

Yeah, sorry, no. That causes some regression errors.

Should be satisfactory now, I hope!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SingleStreamProjection dispatches to wrong Apply overload for nested event versions

2 participants